﻿using MCPlatform.Dxf.Utils;
using netDxf;
using netDxf.Entities;
using System;
using System.Linq;
using System.Windows.Shapes;
using static netDxf.Entities.HatchBoundaryPath;

namespace MCPlatform.Dxf.Entities
{
    public class PointPathEntity : PathEntityBase
    {
        public Vector3 Position { get; }

       
        public Point Point { get; }

        public PointPathEntity(Point point)
        {
            Point = point;
            Type = point;
            Handle = point.Handle;
            Position = new Vector3(point.Position.X, point.Position.Y, point.Position.Z); // 使用三维坐标  
        }


        public void DrawShape(Point? point, float scaleX = 1, float scaleY = 1, float strokeThickness = 1f)
        {
            if (point is null)
            {
                point = this.Point;
            }

            // 创建并配置椭圆形状
            System.Windows.Shapes.Ellipse pointShape = new System.Windows.Shapes.Ellipse
            {
               Width = Utility.GetNumberFromTextToFloat(point.Lineweight.ToString(), point.Layer.Lineweight.ToString()) ?? strokeThickness,
               Height = Utility.GetNumberFromTextToFloat(point.Lineweight.ToString(), point.Layer.Lineweight.ToString()) ?? strokeThickness,
               Fill = Utility.ConvertAciColorToBrush(point.Color),
               Stroke = Utility.ConvertAciColorToBrush(point.Color),
               
            };
            this.Shape = pointShape;

            this.Shape.Tag = point.Handle;
        }
       
    }
}
